package com.apts.servise;

import java.util.HashMap;
import java.util.Map;

import com.apts.jfinalbase.BaseJsonPojo;
import com.apts.model.TbRealRoots;
import com.apts.model.TbTwoCode;
import com.apts.pojo.NomalPojo;

public class QRcodeServise {
	public static final QRcodeServise Servise = new QRcodeServise();

	// 二维码生成
	public int QRcodeGenerate(Map<String, Object> map) {
		int maxid = TbRealRoots.dao.ADD(map);
		return maxid;
	}

	// 二维码扫描
	public BaseJsonPojo QRcodeScan(String id) {
		System.out.println("扫描二维码：servise");

		TbTwoCode tb = TbTwoCode.dao.Scan(id);

		Map<String, Object> map = new HashMap<String, Object>(0);
		map.put("realcode", tb.get("realcode"));
		map.put("regcode", tb.get("regcode"));
		map.put("typecode", tb.get("typecode"));
		map.put("fromarea", tb.get("fromarea"));
		map.put("startdate", tb.get("startdate"));
		map.put("expdate", tb.get("expdate"));
		map.put("codePiNO", tb.get("codePiNO"));
		map.put("codecreatetime", tb.get("codecreatetime"));
		map.put("codeActivetime", tb.get("codeActivetime"));
		map.put("codescanftimes", tb.get("codescanftimes"));
		map.put("codeOvertime", tb.get("codeOvertime"));

		return new NomalPojo(map);

	}

	// 根据实体表的实体编号查找记录
	public TbTwoCode FindByRealcode(String realcode) {
		TbTwoCode tb = TbTwoCode.dao.findbyrealcode(realcode);
		return tb;
	}

	// 二维码激活
	public void Active(String id) {
		TbTwoCode.dao.Active(id);
	}

}
